// vue.config.js
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
    publicPath: "/",
    lintOnSave: true,
    runtimeCompiler: true,
    pages: {
        index: {
            entry: "./src/main.js",
            template: "public/index.html",
            filename: "index.html",
            title: "earthdemo",
        }

    },
  
    configureWebpack: config => {
        const cwp = new CopyWebpackPlugin( [{
                    from: './node_modules/earthsdk/dist/XbsjCesium',
                    to: 'js/earthsdk/XbsjCesium',
                    toType: 'dir'
                },
                {
                    from: './node_modules/earthsdk/dist/XbsjEarth',
                    to: 'js/earthsdk/XbsjEarth',
                    toType: 'dir'
                },
                {
                    from: "public/XbsjEarth-Private-Plugins",
                    to: "XbsjEarth-Plugins",
                },
            ]
        );
        config.plugins.push(cwp);
    },

    devServer: {
        host: "localhost",
        port: 8088,
        https: false,
        host: '0.0.0.0',
        open: true,
        proxy: {
            "/api": {
                target: "http://web.dcyun.com:48433/api", //跨域
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    "^/api": ""
                }
            },
            "/": {
                target: "http://localhost:3003",
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    "^/": "",
                },
            },

        },

        quiet: true,
    },

}